(0) Obligation:
The Runtime Complexity (innermost) of the given
CpxTRS could be proven to be
BOUNDS(1, n^1).
The TRS R consists of the following rules:
foldl(x, Cons(S(0), xs)) → foldl(S(x), xs)
foldl(S(0), Cons(x, xs)) → foldl(S(x), xs)
foldr(a, Cons(x, xs)) → op(x, foldr(a, xs))
foldr(a, Nil) → a
foldl(a, Nil) → a
notEmpty(Cons(x, xs)) → True
notEmpty(Nil) → False
op(x, S(0)) → S(x)
op(S(0), y) → S(y)
fold(a, xs) → Cons(foldl(a, xs), Cons(foldr(a, xs), Nil))
Rewrite Strategy: INNERMOST
(1) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)
Converted Cpx (relative) TRS to CDT
(2) Obligation:
Complexity Dependency Tuples Problem
Rules:
foldl(z0, Cons(S(0), z1)) → foldl(S(z0), z1)
foldl(S(0), Cons(z0, z1)) → foldl(S(z0), z1)
foldl(z0, Nil) → z0
foldr(z0, Cons(z1, z2)) → op(z1, foldr(z0, z2))
foldr(z0, Nil) → z0
notEmpty(Cons(z0, z1)) → True
notEmpty(Nil) → False
op(z0, S(0)) → S(z0)
op(S(0), z0) → S(z0)
fold(z0, z1) → Cons(foldl(z0, z1), Cons(foldr(z0, z1), Nil))
Tuples:
FOLDL(z0, Cons(S(0), z1)) → c(FOLDL(S(z0), z1))
FOLDL(S(0), Cons(z0, z1)) → c1(FOLDL(S(z0), z1))
FOLDL(z0, Nil) → c2
FOLDR(z0, Cons(z1, z2)) → c3(OP(z1, foldr(z0, z2)), FOLDR(z0, z2))
FOLDR(z0, Nil) → c4
NOTEMPTY(Cons(z0, z1)) → c5
NOTEMPTY(Nil) → c6
OP(z0, S(0)) → c7
OP(S(0), z0) → c8
FOLD(z0, z1) → c9(FOLDL(z0, z1), FOLDR(z0, z1))
S tuples:
FOLDL(z0, Cons(S(0), z1)) → c(FOLDL(S(z0), z1))
FOLDL(S(0), Cons(z0, z1)) → c1(FOLDL(S(z0), z1))
FOLDL(z0, Nil) → c2
FOLDR(z0, Cons(z1, z2)) → c3(OP(z1, foldr(z0, z2)), FOLDR(z0, z2))
FOLDR(z0, Nil) → c4
NOTEMPTY(Cons(z0, z1)) → c5
NOTEMPTY(Nil) → c6
OP(z0, S(0)) → c7
OP(S(0), z0) → c8
FOLD(z0, z1) → c9(FOLDL(z0, z1), FOLDR(z0, z1))
K tuples:none
Defined Rule Symbols:
foldl, foldr, notEmpty, op, fold
Defined Pair Symbols:
FOLDL, FOLDR, NOTEMPTY, OP, FOLD
Compound Symbols:
c, c1, c2, c3, c4, c5, c6, c7, c8, c9
(3) CdtLeafRemovalProof (ComplexityIfPolyImplication transformation)
Removed 1 leading nodes:
FOLD(z0, z1) → c9(FOLDL(z0, z1), FOLDR(z0, z1))
Removed 6 trailing nodes:
NOTEMPTY(Nil) → c6
OP(z0, S(0)) → c7
OP(S(0), z0) → c8
NOTEMPTY(Cons(z0, z1)) → c5
FOLDL(z0, Nil) → c2
FOLDR(z0, Nil) → c4
(4) Obligation:
Complexity Dependency Tuples Problem
Rules:
foldl(z0, Cons(S(0), z1)) → foldl(S(z0), z1)
foldl(S(0), Cons(z0, z1)) → foldl(S(z0), z1)
foldl(z0, Nil) → z0
foldr(z0, Cons(z1, z2)) → op(z1, foldr(z0, z2))
foldr(z0, Nil) → z0
notEmpty(Cons(z0, z1)) → True
notEmpty(Nil) → False
op(z0, S(0)) → S(z0)
op(S(0), z0) → S(z0)
fold(z0, z1) → Cons(foldl(z0, z1), Cons(foldr(z0, z1), Nil))
Tuples:
FOLDL(z0, Cons(S(0), z1)) → c(FOLDL(S(z0), z1))
FOLDL(S(0), Cons(z0, z1)) → c1(FOLDL(S(z0), z1))
FOLDR(z0, Cons(z1, z2)) → c3(OP(z1, foldr(z0, z2)), FOLDR(z0, z2))
S tuples:
FOLDL(z0, Cons(S(0), z1)) → c(FOLDL(S(z0), z1))
FOLDL(S(0), Cons(z0, z1)) → c1(FOLDL(S(z0), z1))
FOLDR(z0, Cons(z1, z2)) → c3(OP(z1, foldr(z0, z2)), FOLDR(z0, z2))
K tuples:none
Defined Rule Symbols:
foldl, foldr, notEmpty, op, fold
Defined Pair Symbols:
FOLDL, FOLDR
Compound Symbols:
c, c1, c3
(5) CdtRhsSimplificationProcessorProof (BOTH BOUNDS(ID, ID) transformation)
Removed 1 trailing tuple parts
(6) Obligation:
Complexity Dependency Tuples Problem
Rules:
foldl(z0, Cons(S(0), z1)) → foldl(S(z0), z1)
foldl(S(0), Cons(z0, z1)) → foldl(S(z0), z1)
foldl(z0, Nil) → z0
foldr(z0, Cons(z1, z2)) → op(z1, foldr(z0, z2))
foldr(z0, Nil) → z0
notEmpty(Cons(z0, z1)) → True
notEmpty(Nil) → False
op(z0, S(0)) → S(z0)
op(S(0), z0) → S(z0)
fold(z0, z1) → Cons(foldl(z0, z1), Cons(foldr(z0, z1), Nil))
Tuples:
FOLDL(z0, Cons(S(0), z1)) → c(FOLDL(S(z0), z1))
FOLDL(S(0), Cons(z0, z1)) → c1(FOLDL(S(z0), z1))
FOLDR(z0, Cons(z1, z2)) → c3(FOLDR(z0, z2))
S tuples:
FOLDL(z0, Cons(S(0), z1)) → c(FOLDL(S(z0), z1))
FOLDL(S(0), Cons(z0, z1)) → c1(FOLDL(S(z0), z1))
FOLDR(z0, Cons(z1, z2)) → c3(FOLDR(z0, z2))
K tuples:none
Defined Rule Symbols:
foldl, foldr, notEmpty, op, fold
Defined Pair Symbols:
FOLDL, FOLDR
Compound Symbols:
c, c1, c3
(7) CdtUsableRulesProof (EQUIVALENT transformation)
The following rules are not usable and were removed:
foldl(z0, Cons(S(0), z1)) → foldl(S(z0), z1)
foldl(S(0), Cons(z0, z1)) → foldl(S(z0), z1)
foldl(z0, Nil) → z0
foldr(z0, Cons(z1, z2)) → op(z1, foldr(z0, z2))
foldr(z0, Nil) → z0
notEmpty(Cons(z0, z1)) → True
notEmpty(Nil) → False
op(z0, S(0)) → S(z0)
op(S(0), z0) → S(z0)
fold(z0, z1) → Cons(foldl(z0, z1), Cons(foldr(z0, z1), Nil))
(8) Obligation:
Complexity Dependency Tuples Problem
Rules:none
Tuples:
FOLDL(z0, Cons(S(0), z1)) → c(FOLDL(S(z0), z1))
FOLDL(S(0), Cons(z0, z1)) → c1(FOLDL(S(z0), z1))
FOLDR(z0, Cons(z1, z2)) → c3(FOLDR(z0, z2))
S tuples:
FOLDL(z0, Cons(S(0), z1)) → c(FOLDL(S(z0), z1))
FOLDL(S(0), Cons(z0, z1)) → c1(FOLDL(S(z0), z1))
FOLDR(z0, Cons(z1, z2)) → c3(FOLDR(z0, z2))
K tuples:none
Defined Rule Symbols:none
Defined Pair Symbols:
FOLDL, FOLDR
Compound Symbols:
c, c1, c3
(9) CdtRuleRemovalProof (UPPER BOUND(ADD(n^1)) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
FOLDL(z0, Cons(S(0), z1)) → c(FOLDL(S(z0), z1))
FOLDL(S(0), Cons(z0, z1)) → c1(FOLDL(S(z0), z1))
FOLDR(z0, Cons(z1, z2)) → c3(FOLDR(z0, z2))
We considered the (Usable) Rules:none
And the Tuples:
FOLDL(z0, Cons(S(0), z1)) → c(FOLDL(S(z0), z1))
FOLDL(S(0), Cons(z0, z1)) → c1(FOLDL(S(z0), z1))
FOLDR(z0, Cons(z1, z2)) → c3(FOLDR(z0, z2))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(0) = 0
POL(Cons(x1, x2)) = [1] + x1 + x2
POL(FOLDL(x1, x2)) = x2
POL(FOLDR(x1, x2)) = x2
POL(S(x1)) = [1]
POL(c(x1)) = x1
POL(c1(x1)) = x1
POL(c3(x1)) = x1
(10) Obligation:
Complexity Dependency Tuples Problem
Rules:none
Tuples:
FOLDL(z0, Cons(S(0), z1)) → c(FOLDL(S(z0), z1))
FOLDL(S(0), Cons(z0, z1)) → c1(FOLDL(S(z0), z1))
FOLDR(z0, Cons(z1, z2)) → c3(FOLDR(z0, z2))
S tuples:none
K tuples:
FOLDL(z0, Cons(S(0), z1)) → c(FOLDL(S(z0), z1))
FOLDL(S(0), Cons(z0, z1)) → c1(FOLDL(S(z0), z1))
FOLDR(z0, Cons(z1, z2)) → c3(FOLDR(z0, z2))
Defined Rule Symbols:none
Defined Pair Symbols:
FOLDL, FOLDR
Compound Symbols:
c, c1, c3
(11) SIsEmptyProof (BOTH BOUNDS(ID, ID) transformation)
The set S is empty
(12) BOUNDS(1, 1)